import axios from '@/util'; 

import type {
  PostEntity,
} from './typings';



/**
 * 创建岗位 POST /api/post
 */
export async function post_api_post (
  data: {
    /** 岗位编码 */
    code?: string;
    /** 岗位名称 */
    name?: string;
    /** 排序 */
    orderNum?: number;
    /** 备注 */
    remark?: string;
  },
  options?: Record<string, any>,
): Promise<PostEntity> {
  return axios({
    method: 'POST',
    url: `/api/post`,
    data: {
      ...data,
    },
    ...(options || {}),
  })
}

/**
 * 岗位更新 PUT /api/post
 */
export async function put_api_post (
  data: {
    /** id */
    id?: string;
    /** 部门名称 */
    name?: string;
    /** 岗位编码 */
    code?: string;
    /** 状态 */
    status?: number;
    /** 排序 */
    orderNum?: number;
    /** 备注 */
    remark?: string;
  },
  options?: Record<string, any>,
): Promise<any> {
  return axios({
    method: 'PUT',
    url: `/api/post`,
    data: {
      ...data,
    },
    ...(options || {}),
  })
}

/**
 * 查询岗位列表 GET /api/post/list
 */
export async function get_api_post_list (
  params: {
    /** 显示页数 */
    page: any;
    /** 每页显示条数 */
    size: any;
    /** 岗位名称 */
    name?: any;
    /** 岗位编码 */
    code?: any;
    /** 状态 0-禁用，1-正常使用 */
    status?: any;
  },
  options?: Record<string, any>,
): Promise<PostEntity> {
  return axios({
    method: 'GET',
    url: `/api/post/list`,
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/**
 * 查询岗位详情 GET /api/post/{id}
 */
export async function get_api_post__id_ (
  pathVars: {
    /**  */
    id: any;
  },
  options?: Record<string, any>,
): Promise<PostEntity> {
  return axios({
    method: 'GET',
    url: `/api/post/${pathVars.id}`,
    ...(options || {}),
  })
}

/**
 * 删除岗位 DELETE /api/post/{id}
 */
export async function delete_api_post__id_ (
  pathVars: {
    /**  */
    id: any;
  },
  options?: Record<string, any>,
): Promise<any> {
  return axios({
    method: 'DELETE',
    url: `/api/post/${pathVars.id}`,
    ...(options || {}),
  })
}
